  function renderUser() {
    axios.get('/my/user/userinfo').then(res => {
      console.log(res);
      let {username , nickname, email} = res.data.data;
      $('input[name=username]').val(username)
      $('input[name=nickname]').val(nickname)
      $('input[name=email]').val(email)

      let form = layui.form;
      form.val('abc', res.data.data)
    })
  }

  renderUser();
// ----------------------完成修改----------------------
$('form').on('submit', function (e) {
  e.preventDefault();
  let data = $(this).serialize();
  axios.post('/my/user/userinfo', data).then( res => {
    let {status , message} = res.data;
    if(status === 0) {
      layer.msg(message)
      window.parent.getUserInfo();
    }
  })
})

// ----------------------重置----------------------
$('button[type=reset]').on('click', function (e) {
  e.preventDefault();
  renderUser();
})